﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="list.aspx.cs" Inherits="orgman_users_list" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>用户列表</title>
    <link href="../../css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div id="content">
            用户列表（注意：一个用户可对应多个角色，所以一个用户可能会有多条记录）：<asp:SqlDataSource ID="sds1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:appConnectionString %>" 
                
                
                
                SelectCommand="SELECT users.userid, users.username, users.realname, users.sex, users.email, users.mphone, users.phone, users.address, users.postcode, users.organizationid, users.description, role.rolename, login.available FROM users INNER JOIN organization ON users.organizationid = organization.organizationid AND users.username &lt;&gt; organization.creator INNER JOIN userrole ON users.userid = userrole.userid INNER JOIN role ON userrole.roleid = role.roleid INNER JOIN login ON users.username = login.username WHERE (users.organizationid = @organizationid) AND (login.available = 'true')">
                <SelectParameters>
                    <asp:SessionParameter Name="organizationid" SessionField="organizationid" 
                        Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="userid" DataSourceID="sds1" CellPadding="4" 
                Width="100%" ForeColor="#333333" GridLines="None">
                <FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <Columns>
                    <asp:BoundField DataField="userid" HeaderText="用户ID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="userid" Visible="False" >
                        <ItemStyle Width="5px" HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="username" HeaderText="用户名" 
                        SortExpression="username" >
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="rolename" HeaderText="用户角色" 
                        SortExpression="rolename">
                        <ItemStyle HorizontalAlign="Center" Width="85px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="realname" HeaderText="真实姓名" 
                        SortExpression="realname" >
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="sex" HeaderText="性别" SortExpression="sex" >
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="email" HeaderText="E-mail" SortExpression="email" >
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:BoundField DataField="mphone" HeaderText="手机号码" SortExpression="mphone" >
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>
                    <asp:HyperLinkField DataNavigateUrlFields="username" 
                        DataNavigateUrlFormatString="edit.aspx?un={0}" 
                        Text="&lt;img src='../../images/detail.gif' alt='修改' /&gt;" >
                        <ItemStyle Width="60px" HorizontalAlign="Right" />
                    </asp:HyperLinkField>
                    <asp:HyperLinkField DataNavigateUrlFields="username" 
                        DataNavigateUrlFormatString="del.aspx?un={0}" 
                        Text="&lt;img src='../../images/del.gif' alt='删除' /&gt;" >
                        <ItemStyle Width="60px" HorizontalAlign="Right" />
                    </asp:HyperLinkField>
                </Columns>
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
        </div>
    </div>
    </form>
</body>
</html>
